#include "StdAfx.h"
#include "ConsumerCreditCardModel.h"


ConsumerCreditCardModel::ConsumerCreditCardModel(void)
{
	m_id = -1;
	m_consumerID = -1;
	m_creditCardBank = "";
	m_creditCardLimit = _T("");
	m_creditCardUsed = _T("");
}

ConsumerCreditCardModel::~ConsumerCreditCardModel(void)
{
}

void ConsumerCreditCardModel::parseFromJson(Json::Value& jsonData)
{
	CUtils::getJsonStringField(jsonData, "creditCardBank", m_creditCardBank);
	CUtils::getJsonStringField(jsonData, "useMoney", m_creditCardUsed);
	CUtils::getJsonStringField(jsonData, "limitMoney", m_creditCardLimit);
}

void ConsumerCreditCardModel::toJson(Json::Value& jsonData)
{
	if (this->m_creditCardBank >= 0) 
	{
		jsonData["creditCardBank"] = this->m_creditCardBank.GetBuffer();
	}
	if (this->m_creditCardLimit.GetLength() > 0) 
	{
		 jsonData["limitMoney"] = this->m_creditCardLimit.GetBuffer();
	}
	if (this->m_creditCardUsed.GetLength() > 0) 
	{
		 jsonData["useMoney"] = this->m_creditCardUsed.GetBuffer();
	}
}